public class doublenode {
    public static void main(String[] args) {
        int[] nums = {0,1,2,2,3,3,4};
        System.out.println(removedup(nums));
    }

    private static int removedup(int[] nums) {
        if(nums==null){
            return 0;
        }
        int i=0;
        for(int j=1;j<nums.length;j++){
            if(nums[i]!=nums[j]){
                i++;
                nums[i]=nums[j];
            }
        }
        return i+1;
    }
}
